<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libslic3r: src/libslic3r/libslic3r.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Slic3r_192px_transparent.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libslic3r
   </div>
   <div id="projectbrief">Library for generating gcode from 3d models</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_f69e6fbaea45487e96bc9ed8ccf9ff8f.html">libslic3r</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">libslic3r.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="libslic3r_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef _libslic3r_h_</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define _libslic3r_h_</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">// this needs to be included early for MSVC (listing it in Build.PL is not enough)</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;ostream&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;math.h&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &lt;queue&gt;</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;sstream&gt;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;boost/thread.hpp&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">/* Implementation of CONFESS(&quot;foo&quot;): */</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#ifdef _MSC_VER</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">    #define CONFESS(...) confess_at(__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="libslic3r_8h.html#adad7415ef72b086d2cb55825ae20b963">   17</a></span>&#160;<span class="preprocessor">    #define CONFESS(...) confess_at(__FILE__, __LINE__, __func__, __VA_ARGS__)</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keywordtype">void</span> <a class="code" href="libslic3r_8h.html#ab82d8c0093d2d133902aaba13deb66a1">confess_at</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *file, <span class="keywordtype">int</span> line, <span class="keyword">const</span> <span class="keywordtype">char</span> *func, <span class="keyword">const</span> <span class="keywordtype">char</span> *pat, ...);</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">/* End implementation of CONFESS(&quot;foo&quot;): */</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">// Which C++ version is supported?</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// For example, could optimized functions with move semantics be used?</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#if __cplusplus==201402L</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">    #define SLIC3R_CPPVER 14</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">    #define STDMOVE(WHAT) std::move(WHAT)</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#elif __cplusplus==201103L</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">    #define SLIC3R_CPPVER 11</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">    #define STDMOVE(WHAT) std::move(WHAT)</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="libslic3r_8h.html#a8d3a0758c6d437b9d9932ec9ed05e5ce">   31</a></span>&#160;<span class="preprocessor">    #define SLIC3R_CPPVER 0</span></div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="libslic3r_8h.html#adcb01cd649f75c56c5d2bc1613d155f2">   32</a></span>&#160;<span class="preprocessor">    #define STDMOVE(WHAT) (WHAT)</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment">// dummy macro to mark strings for translation for gettext/poedit</span></div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="libslic3r_8h.html#aacb18b96000a41d8cbbf2088fb770cdb">   36</a></span>&#160;<span class="preprocessor">#define __TRANS(s) s</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespace_slic3r.html">Slic3r</a> {</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#af0ad79e4799b1b483760f769573f99d4">   39</a></span>&#160;constexpr <span class="keyword">auto</span> <a class="code" href="namespace_slic3r.html#af0ad79e4799b1b483760f769573f99d4">SLIC3R_VERSION</a> = <span class="stringliteral">&quot;1.3.0-dev&quot;</span>;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#ab6d77625bc973b0c03e577944f90f297">   41</a></span>&#160;<span class="keyword">typedef</span> <span class="keywordtype">long</span> <a class="code" href="namespace_slic3r.html#ab6d77625bc973b0c03e577944f90f297">coord_t</a>;</div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">   42</a></span>&#160;<span class="keyword">typedef</span> <span class="keywordtype">double</span> <a class="code" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">coordf_t</a>;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">// Scaling factor for a conversion from coord_t to coordf_t: 10e-6</span></div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment">// This scaling generates a following fixed point representation with for a 32bit integer:</span></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">// 0..4294mm with 1nm resolution</span></div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#a61a8e610b852bddce92e1d653ea90eda">   47</a></span>&#160;constexpr <span class="keyword">auto</span> <a class="code" href="namespace_slic3r.html#a61a8e610b852bddce92e1d653ea90eda">SCALING_FACTOR</a> = 0.000001;</div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#a9a0d9b5718fd26081d3fc9f143f2b246">   48</a></span>&#160;<span class="keyword">inline</span> constexpr coord_t  <a class="code" href="namespace_slic3r.html#a9a0d9b5718fd26081d3fc9f143f2b246">scale_</a>(<span class="keyword">const</span> coordf_t &amp;val) { <span class="keywordflow">return</span> val / <a class="code" href="namespace_slic3r.html#a61a8e610b852bddce92e1d653ea90eda">SCALING_FACTOR</a>; }</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#ab57bdde7cab5f77c8d57ac0d25cc85d0">   49</a></span>&#160;<span class="keyword">inline</span> constexpr coordf_t <a class="code" href="namespace_slic3r.html#ab57bdde7cab5f77c8d57ac0d25cc85d0">unscale</a>(<span class="keyword">const</span> coord_t &amp;val) { <span class="keywordflow">return</span> val * <a class="code" href="namespace_slic3r.html#a61a8e610b852bddce92e1d653ea90eda">SCALING_FACTOR</a>; }</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="comment">//FIXME This epsilon value is used for many non-related purposes:</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment">// For a threshold of a squared Euclidean distance,</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="comment">// for a trheshold in a difference of radians,</span></div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment">// for a threshold of a cross product of two non-normalized vectors etc.</span></div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#ace7eb5e675f717ec2ad4b03880bd4142">   55</a></span>&#160;constexpr <span class="keyword">auto</span> <a class="code" href="namespace_slic3r.html#ace7eb5e675f717ec2ad4b03880bd4142">EPSILON</a> = 1e-4;</div><div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#a2f151364ee9f67e9e37f1e591f24129f">   56</a></span>&#160;constexpr <span class="keyword">auto</span> <a class="code" href="namespace_slic3r.html#a2f151364ee9f67e9e37f1e591f24129f">SCALED_EPSILON</a> = <a class="code" href="namespace_slic3r.html#a9a0d9b5718fd26081d3fc9f143f2b246">scale_</a>(EPSILON);</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="comment">// RESOLUTION, SCALED_RESOLUTION: Used as an error threshold for a Douglas-Peucker polyline simplification algorithm.</span></div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#ab9962e4cd8fa98c5fe171f9faf11e8f3">   58</a></span>&#160;constexpr <span class="keyword">auto</span> <a class="code" href="namespace_slic3r.html#ab9962e4cd8fa98c5fe171f9faf11e8f3">RESOLUTION</a> = 0.0125;</div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#a54224c2416b5215725cb501bc0b41956">   59</a></span>&#160;constexpr <span class="keyword">auto</span> <a class="code" href="namespace_slic3r.html#a54224c2416b5215725cb501bc0b41956">SCALED_RESOLUTION</a> = <a class="code" href="namespace_slic3r.html#a9a0d9b5718fd26081d3fc9f143f2b246">scale_</a>(RESOLUTION);</div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#a5c9e075207afe0701500fff332a281bc">   60</a></span>&#160;constexpr <span class="keyword">auto</span> <a class="code" href="namespace_slic3r.html#a5c9e075207afe0701500fff332a281bc">PI</a> = 3.141592653589793238;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="comment">// When extruding a closed loop, the loop is interrupted and shortened a bit to reduce the seam.</span></div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#a4b1c8a57877c8c201250c9bc57e72e69">   62</a></span>&#160;constexpr <span class="keyword">auto</span> <a class="code" href="namespace_slic3r.html#a4b1c8a57877c8c201250c9bc57e72e69">LOOP_CLIPPING_LENGTH_OVER_NOZZLE_DIAMETER</a> = 0.15;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="comment">// Maximum perimeter length for the loop to apply the small perimeter speed. </span></div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#aa6f6c35dc2806eb41143cd584886a16b">   64</a></span>&#160;constexpr coord_t <a class="code" href="namespace_slic3r.html#aa6f6c35dc2806eb41143cd584886a16b">SMALL_PERIMETER_LENGTH</a> = <a class="code" href="namespace_slic3r.html#a9a0d9b5718fd26081d3fc9f143f2b246">scale_</a>(6.5) * 2 * <a class="code" href="namespace_slic3r.html#a5c9e075207afe0701500fff332a281bc">PI</a>;</div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#a1602217e9079a12a04689983f396a891">   65</a></span>&#160;constexpr coordf_t <a class="code" href="namespace_slic3r.html#a1602217e9079a12a04689983f396a891">INSET_OVERLAP_TOLERANCE</a> = 0.4;</div><div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#a4ade234425c7b33f686d9a2877fe984e">   66</a></span>&#160;constexpr coordf_t <a class="code" href="namespace_slic3r.html#a4ade234425c7b33f686d9a2877fe984e">EXTERNAL_INFILL_MARGIN</a> = 3;</div><div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#aaff29b0b09b5569233d0d5a217cd93a0">   67</a></span>&#160;constexpr coord_t <a class="code" href="namespace_slic3r.html#aaff29b0b09b5569233d0d5a217cd93a0">SCALED_EXTERNAL_INFILL_MARGIN</a> = <a class="code" href="namespace_slic3r.html#a9a0d9b5718fd26081d3fc9f143f2b246">scale_</a>(EXTERNAL_INFILL_MARGIN);</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#aec0518765dd6991c31ac6c40872edef8a4ff0bb5a0a25cbaf7b74abc10f83e87e">   69</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="namespace_slic3r.html#aec0518765dd6991c31ac6c40872edef8">Axis</a> { <a class="code" href="namespace_slic3r.html#aec0518765dd6991c31ac6c40872edef8aea4f41ceb26107aab036b3cebd6e3a13">X</a>=0, <a class="code" href="namespace_slic3r.html#aec0518765dd6991c31ac6c40872edef8a27608ebdfb47b8076b0ed8c01be502f9">Y</a>, <a class="code" href="namespace_slic3r.html#aec0518765dd6991c31ac6c40872edef8a4ff0bb5a0a25cbaf7b74abc10f83e87e">Z</a> };</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;</div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#acf7db809cbd1d919d0bd314f5fbdf4a9">   72</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespace_slic3r.html#acf7db809cbd1d919d0bd314f5fbdf4a9">append_to</a>(std::vector&lt;T&gt; &amp;dst, <span class="keyword">const</span> std::vector&lt;T&gt; &amp;src)</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;{</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    dst.insert(dst.end(), src.begin(), src.end());</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;}</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keywordtype">void</span></div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#aed10f7d54a87baeb8d4df8a186cdf871">   78</a></span>&#160;<a class="code" href="namespace_slic3r.html#aed10f7d54a87baeb8d4df8a186cdf871">_parallelize_do</a>(std::queue&lt;T&gt;* queue, boost::mutex* queue_mutex, boost::function&lt;<span class="keywordtype">void</span>(T)&gt; func)</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;{</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="comment">//std::cout &lt;&lt; &quot;THREAD STARTED: &quot; &lt;&lt; boost::this_thread::get_id() &lt;&lt; std::endl;</span></div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        T i;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        {</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;            boost::lock_guard&lt;boost::mutex&gt; l(*queue_mutex);</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;            <span class="keywordflow">if</span> (queue-&gt;empty()) <span class="keywordflow">return</span>;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;            i = queue-&gt;front();</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;            queue-&gt;pop();</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        }</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        <span class="comment">//std::cout &lt;&lt; &quot;  Thread &quot; &lt;&lt; boost::this_thread::get_id() &lt;&lt; &quot; processing item &quot; &lt;&lt; i &lt;&lt; std::endl;</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        func(i);</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        boost::this_thread::interruption_point();</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    }</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;}</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keywordtype">void</span></div><div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#abe125a53a3434f5ef17be7e644ac90a4">   96</a></span>&#160;<a class="code" href="namespace_slic3r.html#abe125a53a3434f5ef17be7e644ac90a4">parallelize</a>(std::queue&lt;T&gt; queue, boost::function&lt;<span class="keywordtype">void</span>(T)&gt; func,</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keywordtype">int</span> threads_count = boost::thread::hardware_concurrency())</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;{</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <span class="keywordflow">if</span> (threads_count == 0) threads_count = 2;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    boost::mutex queue_mutex;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    boost::thread_group workers;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; std::min(threads_count, (<span class="keywordtype">int</span>)queue.size()); i++)</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        workers.add_thread(<span class="keyword">new</span> boost::thread(&amp;_parallelize_do&lt;T&gt;, &amp;queue, &amp;queue_mutex, func));</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    workers.join_all();</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;}</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keywordtype">void</span></div><div class="line"><a name="l00108"></a><span class="lineno"><a class="line" href="namespace_slic3r.html#ab4438f654149815ddb13ce17a231f12c">  108</a></span>&#160;<a class="code" href="namespace_slic3r.html#abe125a53a3434f5ef17be7e644ac90a4">parallelize</a>(T start, T end, boost::function&lt;<span class="keywordtype">void</span>(T)&gt; func,</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="keywordtype">int</span> threads_count = boost::thread::hardware_concurrency())</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;{</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    std::queue&lt;T&gt; queue;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordflow">for</span> (T i = start; i &lt;= end; ++i) queue.push(i);</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    <a class="code" href="namespace_slic3r.html#abe125a53a3434f5ef17be7e644ac90a4">parallelize</a>(queue, func, threads_count);</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;}</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;} <span class="comment">// namespace Slic3r</span></div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="keyword">using namespace </span><a class="code" href="namespace_slic3r.html">Slic3r</a>;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="namespace_slic3r_html_af0ad79e4799b1b483760f769573f99d4"><div class="ttname"><a href="namespace_slic3r.html#af0ad79e4799b1b483760f769573f99d4">Slic3r::SLIC3R_VERSION</a></div><div class="ttdeci">constexpr auto SLIC3R_VERSION</div><div class="ttdef"><b>Definition:</b> libslic3r.h:39</div></div>
<div class="ttc" id="libslic3r_8h_html_ab82d8c0093d2d133902aaba13deb66a1"><div class="ttname"><a href="libslic3r_8h.html#ab82d8c0093d2d133902aaba13deb66a1">confess_at</a></div><div class="ttdeci">void confess_at(const char *file, int line, const char *func, const char *pat,...)</div><div class="ttdef"><b>Definition:</b> utils.cpp:6</div></div>
<div class="ttc" id="namespace_slic3r_html_aec0518765dd6991c31ac6c40872edef8a4ff0bb5a0a25cbaf7b74abc10f83e87e"><div class="ttname"><a href="namespace_slic3r.html#aec0518765dd6991c31ac6c40872edef8a4ff0bb5a0a25cbaf7b74abc10f83e87e">Slic3r::Z</a></div><div class="ttdef"><b>Definition:</b> libslic3r.h:69</div></div>
<div class="ttc" id="namespace_slic3r_html_ace7eb5e675f717ec2ad4b03880bd4142"><div class="ttname"><a href="namespace_slic3r.html#ace7eb5e675f717ec2ad4b03880bd4142">Slic3r::EPSILON</a></div><div class="ttdeci">constexpr auto EPSILON</div><div class="ttdef"><b>Definition:</b> libslic3r.h:55</div></div>
<div class="ttc" id="namespace_slic3r_html_ab6d77625bc973b0c03e577944f90f297"><div class="ttname"><a href="namespace_slic3r.html#ab6d77625bc973b0c03e577944f90f297">Slic3r::coord_t</a></div><div class="ttdeci">long coord_t</div><div class="ttdef"><b>Definition:</b> libslic3r.h:41</div></div>
<div class="ttc" id="namespace_slic3r_html_acf7db809cbd1d919d0bd314f5fbdf4a9"><div class="ttname"><a href="namespace_slic3r.html#acf7db809cbd1d919d0bd314f5fbdf4a9">Slic3r::append_to</a></div><div class="ttdeci">void append_to(std::vector&lt; T &gt; &amp;dst, const std::vector&lt; T &gt; &amp;src)</div><div class="ttdef"><b>Definition:</b> libslic3r.h:72</div></div>
<div class="ttc" id="namespace_slic3r_html_a61a8e610b852bddce92e1d653ea90eda"><div class="ttname"><a href="namespace_slic3r.html#a61a8e610b852bddce92e1d653ea90eda">Slic3r::SCALING_FACTOR</a></div><div class="ttdeci">constexpr auto SCALING_FACTOR</div><div class="ttdef"><b>Definition:</b> libslic3r.h:47</div></div>
<div class="ttc" id="namespace_slic3r_html_aa6f6c35dc2806eb41143cd584886a16b"><div class="ttname"><a href="namespace_slic3r.html#aa6f6c35dc2806eb41143cd584886a16b">Slic3r::SMALL_PERIMETER_LENGTH</a></div><div class="ttdeci">constexpr coord_t SMALL_PERIMETER_LENGTH</div><div class="ttdef"><b>Definition:</b> libslic3r.h:64</div></div>
<div class="ttc" id="namespace_slic3r_html_a1602217e9079a12a04689983f396a891"><div class="ttname"><a href="namespace_slic3r.html#a1602217e9079a12a04689983f396a891">Slic3r::INSET_OVERLAP_TOLERANCE</a></div><div class="ttdeci">constexpr coordf_t INSET_OVERLAP_TOLERANCE</div><div class="ttdef"><b>Definition:</b> libslic3r.h:65</div></div>
<div class="ttc" id="namespace_slic3r_html_ab57bdde7cab5f77c8d57ac0d25cc85d0"><div class="ttname"><a href="namespace_slic3r.html#ab57bdde7cab5f77c8d57ac0d25cc85d0">Slic3r::unscale</a></div><div class="ttdeci">constexpr coordf_t unscale(const coord_t &amp;val)</div><div class="ttdef"><b>Definition:</b> libslic3r.h:49</div></div>
<div class="ttc" id="namespace_slic3r_html_a54224c2416b5215725cb501bc0b41956"><div class="ttname"><a href="namespace_slic3r.html#a54224c2416b5215725cb501bc0b41956">Slic3r::SCALED_RESOLUTION</a></div><div class="ttdeci">constexpr auto SCALED_RESOLUTION</div><div class="ttdef"><b>Definition:</b> libslic3r.h:59</div></div>
<div class="ttc" id="namespace_slic3r_html_a9a0d9b5718fd26081d3fc9f143f2b246"><div class="ttname"><a href="namespace_slic3r.html#a9a0d9b5718fd26081d3fc9f143f2b246">Slic3r::scale_</a></div><div class="ttdeci">constexpr coord_t scale_(const coordf_t &amp;val)</div><div class="ttdef"><b>Definition:</b> libslic3r.h:48</div></div>
<div class="ttc" id="namespace_slic3r_html_aec0518765dd6991c31ac6c40872edef8aea4f41ceb26107aab036b3cebd6e3a13"><div class="ttname"><a href="namespace_slic3r.html#aec0518765dd6991c31ac6c40872edef8aea4f41ceb26107aab036b3cebd6e3a13">Slic3r::X</a></div><div class="ttdef"><b>Definition:</b> libslic3r.h:69</div></div>
<div class="ttc" id="namespace_slic3r_html_ab9962e4cd8fa98c5fe171f9faf11e8f3"><div class="ttname"><a href="namespace_slic3r.html#ab9962e4cd8fa98c5fe171f9faf11e8f3">Slic3r::RESOLUTION</a></div><div class="ttdeci">constexpr auto RESOLUTION</div><div class="ttdef"><b>Definition:</b> libslic3r.h:58</div></div>
<div class="ttc" id="namespace_slic3r_html_a2ac5c755948c74f5f5f975acd5057fe9"><div class="ttname"><a href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">Slic3r::coordf_t</a></div><div class="ttdeci">double coordf_t</div><div class="ttdef"><b>Definition:</b> libslic3r.h:42</div></div>
<div class="ttc" id="namespace_slic3r_html"><div class="ttname"><a href="namespace_slic3r.html">Slic3r</a></div><div class="ttdef"><b>Definition:</b> BoundingBox.cpp:4</div></div>
<div class="ttc" id="namespace_slic3r_html_a4ade234425c7b33f686d9a2877fe984e"><div class="ttname"><a href="namespace_slic3r.html#a4ade234425c7b33f686d9a2877fe984e">Slic3r::EXTERNAL_INFILL_MARGIN</a></div><div class="ttdeci">constexpr coordf_t EXTERNAL_INFILL_MARGIN</div><div class="ttdef"><b>Definition:</b> libslic3r.h:66</div></div>
<div class="ttc" id="namespace_slic3r_html_a5c9e075207afe0701500fff332a281bc"><div class="ttname"><a href="namespace_slic3r.html#a5c9e075207afe0701500fff332a281bc">Slic3r::PI</a></div><div class="ttdeci">constexpr auto PI</div><div class="ttdef"><b>Definition:</b> libslic3r.h:60</div></div>
<div class="ttc" id="namespace_slic3r_html_a2f151364ee9f67e9e37f1e591f24129f"><div class="ttname"><a href="namespace_slic3r.html#a2f151364ee9f67e9e37f1e591f24129f">Slic3r::SCALED_EPSILON</a></div><div class="ttdeci">constexpr auto SCALED_EPSILON</div><div class="ttdef"><b>Definition:</b> libslic3r.h:56</div></div>
<div class="ttc" id="namespace_slic3r_html_aec0518765dd6991c31ac6c40872edef8a27608ebdfb47b8076b0ed8c01be502f9"><div class="ttname"><a href="namespace_slic3r.html#aec0518765dd6991c31ac6c40872edef8a27608ebdfb47b8076b0ed8c01be502f9">Slic3r::Y</a></div><div class="ttdef"><b>Definition:</b> libslic3r.h:69</div></div>
<div class="ttc" id="namespace_slic3r_html_aaff29b0b09b5569233d0d5a217cd93a0"><div class="ttname"><a href="namespace_slic3r.html#aaff29b0b09b5569233d0d5a217cd93a0">Slic3r::SCALED_EXTERNAL_INFILL_MARGIN</a></div><div class="ttdeci">constexpr coord_t SCALED_EXTERNAL_INFILL_MARGIN</div><div class="ttdef"><b>Definition:</b> libslic3r.h:67</div></div>
<div class="ttc" id="namespace_slic3r_html_aec0518765dd6991c31ac6c40872edef8"><div class="ttname"><a href="namespace_slic3r.html#aec0518765dd6991c31ac6c40872edef8">Slic3r::Axis</a></div><div class="ttdeci">Axis</div><div class="ttdef"><b>Definition:</b> libslic3r.h:69</div></div>
<div class="ttc" id="namespace_slic3r_html_a4b1c8a57877c8c201250c9bc57e72e69"><div class="ttname"><a href="namespace_slic3r.html#a4b1c8a57877c8c201250c9bc57e72e69">Slic3r::LOOP_CLIPPING_LENGTH_OVER_NOZZLE_DIAMETER</a></div><div class="ttdeci">constexpr auto LOOP_CLIPPING_LENGTH_OVER_NOZZLE_DIAMETER</div><div class="ttdef"><b>Definition:</b> libslic3r.h:62</div></div>
<div class="ttc" id="namespace_slic3r_html_aed10f7d54a87baeb8d4df8a186cdf871"><div class="ttname"><a href="namespace_slic3r.html#aed10f7d54a87baeb8d4df8a186cdf871">Slic3r::_parallelize_do</a></div><div class="ttdeci">void _parallelize_do(std::queue&lt; T &gt; *queue, boost::mutex *queue_mutex, boost::function&lt; void(T)&gt; func)</div><div class="ttdef"><b>Definition:</b> libslic3r.h:78</div></div>
<div class="ttc" id="namespace_slic3r_html_abe125a53a3434f5ef17be7e644ac90a4"><div class="ttname"><a href="namespace_slic3r.html#abe125a53a3434f5ef17be7e644ac90a4">Slic3r::parallelize</a></div><div class="ttdeci">void parallelize(std::queue&lt; T &gt; queue, boost::function&lt; void(T)&gt; func, int threads_count=boost::thread::hardware_concurrency())</div><div class="ttdef"><b>Definition:</b> libslic3r.h:96</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
